<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box1 {
            width: 300px;
            height: 300px;
            background-color: red;
            position: relative;
        }

        .box2 {
            width: 50px;
            height: 25px;
            text-align: center;
            position: absolute;
            top: 0;
            right: 0;
        }
    </style>
</head>

<body>
    <div class="box1">
        <button class="box2">点击我</button>
    </div>
    <!-- <ul id="nav">
        <li>我的首页</li>
        <li>产品介绍</li>
        <li>联系方式</li>
    </ul>
    <p>123456</p>
    <script>
        const list = document.querySelectorAll('#nav li')
        for (i = 0; i < list.length; i++) {
            console.log(list[i]);
        }
        list[0].style.color = 'red'
        const xx = document.querySelector('p')
        console.log(xx);

    </script> -->

    <!-- <input type="checkbox" class="inp">
    <script>
        const inp = document.querySelector('input')
        inp.checked = true -->
    <script>
        const but = document.querySelector('button')
        const box1 = document.querySelector('.box1')
        but.style.color = 'black'
        but.style.width = '80px'
        but.addEventListener('click', function () {
            box1.style.display = 'none'
        })
    </script>
</body>

</html>